<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>悬停变色</title>
  <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
  </script>
  <script>
    $(document).ready(function () {
      $("p").hover(function () {
        $("p").css("background-color", "yellow");
      }, function () {
        $("p").css("background-color", "pink");
      });
    });
  </script>
</head>

<body>
  <p>鼠标移动到该段落。</p>
</body>

</html>